package main

import (
	"flag"
	"time"

	http "go-toolkit/library/net/http"
	bm "go-toolkit/library/net/http/blademaster"
	xtime "go-toolkit/library/time"
)

var bind string

func init() {
	flag.StringVar(&bind, "bind", ":8000", "bind address")
}

func main() {
	flag.Parse()
	c := &http.ServerConfig{
		Addr:         bind,
		Timeout:      xtime.Duration(time.Second),
		ReadTimeout:  xtime.Duration(time.Second),
		WriteTimeout: xtime.Duration(time.Second),
	}
	engine := bm.DefaultServer(c)
	engine.GET("/echo", func(ctx *bm.Context) {
		ctx.JSON("helloworld", nil)
	})
	engine.Start()
	select {}
}
